import { _HttpClient } from '@delon/theme';
import {Injectable} from '@angular/core';
import {environment} from '../../environments/environment';

@Injectable()
export class AppInfoService {
    constructor(public http: _HttpClient) {}

    // //根据服务id获取环境下拉列表
    // public getSystemEnvironmentList(serviceId) {
    //     const data = {
    //         "body": {
    //             "confEnvironmentDTO": {
    //                 "serviceId": "a9e9a2e025284402ad090bc63a0c803d"
    //             }
    //         }
    //     };
    //     const url =  environment.SERVER_URL + 'application/getSystemEnvironmentList';
    //     return this.http.post(url, data);
    // }

    // //获取所有环境下拉列表
    // public getEnvironmentList() {
    //     const url =  environment.REMOTE_URL + 'application/getEnvironmentList';
    //     return this.http.post(url);
    // }

    //分页查询应用列表
    public queryAppInfoList(currentPage , pageSize , appName): any {
        const data = {
            'body': {
                'pageInfo': {
                    'page': currentPage,
                    'pageSize': pageSize
                },
                'appInfoDTO': {
                    'appName': appName
                }
            }
        };
        const url = environment.SERVER_URL + '/api/angular/appInfo/getAppInfoPageList';
        return this.http.post<any>(url, data);
    }

    //保存应用文件信息
    public saveAppInfo(data): any {
      const url = environment.SERVER_URL + '/api/angular/appInfo/saveAppInfo';
      return this.http.post<any>(url, data);
    }

    //修改应用文件信息
    public updateAppInfo(data): any {
      const url = environment.SERVER_URL + '/api/angular/appInfo/updateAppInfo';
      return this.http.post<any>(url, data);
    }

    //删除应用信息
    public deleteAppInfo(data): any {
      const url = environment.SERVER_URL + '/api/angular/appInfo/deleteAppInfo';
      return this.http.post<any>(url, data);
    }
}
